package com.bdqn.qnnews.wemedia.controller.v1;

import com.bdqn.qnnews.common.base.R;
import com.bdqn.qnnews.wemedia.service.WmUserService;
import com.bdqn.qnnews.wemedia.vo.WmLoginReqVo;
import com.bdqn.qnnews.wemedia.vo.WmUserRespVo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * @author xlz
 * @since 2023-12-26
 * @description 自媒体用户信息表
 */
@Slf4j
@RequiredArgsConstructor
@RestController
@Tag(name = "自媒体用户登录控制器类",
        description = "WmUserLoginController 自媒体用户登录 后端数据接口")
public class WmUserLoginController {

    private final WmUserService wmUserService;


    /**
     * 自媒体用户登录
     * @param loginReqVo 登录参数
     * @return 成功响应
     */
    @Operation(summary = "自媒体用户登录", description = "自媒体端用户登录")
    @PostMapping("/login/in")
    public R<WmUserRespVo> login(@RequestBody @Valid WmLoginReqVo loginReqVo){
        log.debug("{}", loginReqVo);
        final WmUserRespVo userRespVo = wmUserService.login(loginReqVo);
        return R.ok("登录成功", userRespVo);
    }
}
